package com.lmm.rpc.core.client;

import com.lmm.rpc.core.client.async.RpcCallback;
import com.lmm.rpc.core.client.protocol.MessageProtocol;
import com.lmm.rpc.core.client.protocol.RequestMetadata;
import com.lmm.rpc.core.common.reponse.DefaultRepose;
import com.lmm.rpc.core.common.request.DefaultRequest;
import com.lmm.rpc.core.transport.RpcFuture;
import io.netty.channel.Channel;

/**
 * 数据传输通道
 * */
public interface NettyClientTransport<T>{
    /**
     *  同步 发送数据
     * @param metadata
     * @return
     * @throws Exception
     */
    MessageProtocol<DefaultRepose> sendRequest(RequestMetadata metadata,T t
    ) throws Exception;
    /**
     *  异步 发送数据
     * @param metadata
     * @return
     * @throws Exception
     */
    RpcFuture<MessageProtocol<DefaultRepose>> asyncSendRequest(RequestMetadata metadata, T t, RpcCallback rpcCallback);
}
